package com.yifan.core.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author ：zhanglei
 * @date ：Created in 2020-07-03 15:08
 * @description：类反射
 */
public class ClassReflect {

    public static void main(String[] args) {
        Class<?> clazz = null;
        try {
            clazz = Class.forName("com.yifan.core.reflect.ReflectClass");

            Field[] fields = clazz.getFields();
            for(Field field : fields){
                System.out.println("获取属性名称："+field.getName());
            }

            Method[] methods = clazz.getDeclaredMethods();
            for(Method method : methods){
                System.out.println("获取方法名称："+method.getName());
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        System.out.println(clazz);
    }

}
